<script setup lang="ts">
import {ref} from 'vue';

let isshow = ref(true)
isshow.value = false;
let onshow = () =>{
    //1.找标签
    //2.设置display为none
    //if(isshow.value == true){
    //      isshow.value = false;
    //}
    //else{
    //    isshow.value = true;
    //}
    isshow.value = !isshow.value
}
</script>
<template>
    <div>
        <h1 v-if="isshow">hello</h1>
        <h1 v-else>NO</h1>
        <div>
            <button @click="onshow">显示</button>
        </div>
        <div v-show="isshow">我是show</div>
    </div>
</template>
<style scoped></style>